package com.dingjian.broker.enums;

/**
 * 客户类型
 * 
 * @author guhui
 *
 */
public enum CustomerTypeEnum {
	PUBLIC("PUBLIC","公客"), //公客
	PRIVATE("PRIVATE","私客"); //私客
	
	private CustomerTypeEnum(){}
	private CustomerTypeEnum(String key,String description){
		this.key=key;
		this.description=description;
	}
	private String key;
	
	private String description;

	public String getKey() {
		return key;
	}
	public void setKey(String key) {
		this.key = key;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	/**
	 * 取枚举的json字符串
	 * @return
	 */
	public static String getJsonStr(){
		CustomerTypeEnum[] enums = CustomerTypeEnum.values();
		StringBuffer jsonStr = new StringBuffer("[");
		for (CustomerTypeEnum senum : enums) {
			if(!"[".equals(jsonStr.toString())){
				jsonStr.append(",");
			}
			jsonStr.append("{id:'")
					.append(senum)
					.append("',name:'")
					.append(senum.getDescription())
					.append("',value:'")
					.append(senum)
					.append("'}");
		}
		jsonStr.append("]");
		return jsonStr.toString();
	}
}
